<template>
  <div>
    <el-descriptions
      class="margin-top"
      title="财务信息"
      :column="2"
      size="small"
      border
      v-if="id != null"
    >
      <el-descriptions-item label="购入余额">
        <i class="el-icon-money" /> {{ form.amount }}
      </el-descriptions-item>
      <el-descriptions-item label="入账金额">
        <i class="el-icon-tickets" /> {{ form.intoAmount }}
      </el-descriptions-item>
      <el-descriptions-item label="减值">
        <i class="el-icon-warning" /> {{ form.impairment }}
      </el-descriptions-item>
      <el-descriptions-item label="折旧方法">
        <el-tag v-if="form.depreciatedMethod === 1" type="info">平均年限法</el-tag>
        <el-tag v-else-if="form.depreciatedMethod === 2" type="warning"
          >不折旧</el-tag
        >
        <el-tag v-else>未知方法</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="计提方式">
        <el-tag v-if="form.accrualMethod === 1" type="success">当月增加，次月计提</el-tag>
        <el-tag v-else-if="form.accrualMethod === 2" type="danger"
          >当月增加，次月计提</el-tag
        >
        <el-tag v-else>未知方式</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="预计使用年限">
        <i class="el-icon-clock" /> {{ form.estimateUsageTerm }}
      </el-descriptions-item>
      <el-descriptions-item label="税额">
        <i class="el-icon-sold-out" /> {{ form.tax }}
      </el-descriptions-item>
      <el-descriptions-item label="残值率">
        <i class="el-icon-star-off" />
        {{ form.residualValueRate }}
      </el-descriptions-item>
      <el-descriptions-item label="清理日期" v-if="form.cleanDate != null">
        <el-date-picker v-model="form.cleanDate" type="date":disabled="true"/>
      </el-descriptions-item>
      <el-descriptions-item label="录入日期" v-if="form.inputDate != null">
        <el-date-picker v-model="form.inputDate" type="date":disabled="true"/>
      </el-descriptions-item>
      <el-descriptions-item label="用途">
        <i class="el-icon-tool" /> {{ form.usage }}
      </el-descriptions-item>
    </el-descriptions>
  </div>
</template>

<script>
import { fixedAsset } from "@/api/fixedAsset";
// import { parseTime } from "@/utils/index.js";
export default {
  props: ["id"],
  data() {
    return {
      form: {},
    };
  },
  created() {
    this.getAccountFixedAsset();
  },
  methods: {
    getAccountFixedAsset() {
      fixedAsset.findAccount(this.id).then((res) => {
        this.form = res.data;
      });
    },
  },
};
</script>

<style scoped></style>
